<?php
namespace App\Controllers\Product\Page;

use \App\Models\Goods\Goods;
use \App\Models\Goods\GoodsAffiliate;
/**
*	产品详情页
*
*/
class ProductDel extends  \App\Libs\Base\BaseTwigAction 
{
    protected function beforeRun() {
        parent::beforeRun();
	//	 $this->needLogin = TRUE;
    }
	
	public function execute() {
		$gid = (int)$this->request->get("gid");
		$lat = $this->request->get("latitude");
		$lon = $this->request->get("longitude");
		if( empty($lat) || empty( $lon ) ){
			$lat = '1';
			$lon = '1';
		}
		$goods = Goods::find(array(
			'id=:gid:',
			'bind'=>array('gid'=>$gid)
		));
		$goodsAffiliate = GoodsAffiliate::find(array( 
			'gid=:gid:',
			'bind'=>array('gid'=>$gid)
		));
		
		$show = '1';
		if( $goods->show_status == 1 ){
			$show = 0;
		}
		
		$this->addParam('gid',$gid);
		$this->addParam('lat',$lat);
		$this->addParam('lon',$lon);
		$this->addParam('show',$show);
		$this->addParam('goods',$goods);
		$this->addParam('goodsAffiliate',$goodsAffiliate);
		
		return parent::execute();
	}
}
